<?php
$this->breadcrumbs=array(
	'訂單管理'=>array('index'),
	$model->oid,
);
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/styles.css');
?>
<style>
.head {
	background: none repeat scroll 0 0 #90D8F0;
}
table.tbl th,table.tbl td{
	text-align:center;
}
</style>
<table class="detail-view">
	<tbody>
		<tr class="odd">
			<td width="16%">訂單編號</td>
			<td width="34%">
				<?= $model->oid ?>
			</td>
			<td width="16%">用戶</td>
			<td>
				<?= $model->user->username ?>
			</td>
		</tr>
		<tr class="even">
			<td>付款方式</td>
			<td>
				<?=Yii::app()->params['paytype'][$model->pay_type]?>
			</td>
			<td>訂單狀態</td>
			<td>
				<?=Yii::app()->params['orderstatus'][$model->status]?>
			</td>
		</tr>
		<tr class="odd">
			<td>商品價格小計</td>
			<td>
				<?= $model->total ?>
			</td>
			<td>運費</td>
			<td>
				<?= $model->freight ?>
			</td>
		</tr>
		<tr class="even">
			<td>使用購物金</td>
			<td>
				<?= $model->coin ?>
			</td>
			<td>訂單金額</td>
			<td>
				<?= $model->total_final ?>
			</td>
		</tr>
		<tr class="odd">
			<td>回饋點數</td>
			<td>
				<?= $model->hongyun_return ?>
			</td>
			<td>回饋購物金</td>
			<td>
				<?= $model->coin_return ?>
			</td>
		</tr>
		<tr class="even">
			<td>創建時間</td>
			<td>
				<?= $model->dateline ?>
			</td>
			<td>更新時間</td>
			<td>
				<?= $model->updated ?>
			</td>
		</tr>
		<tr class="odd">
			<td>收件者</td>
			<td>
				<?= $model->consignee ?>
			</td>
			<td>稱謂</td>
			<td>
				<?= $model->pre ?>
			</td>
		</tr>
		<tr class="even">
			<td>電話</td>
			<td>
				<?= $model->phone ?>
			</td>
			<td>E-mail</td>
			<td>
				<?= $model->email ?>
			</td>
		</tr>
		<tr class="odd">
			<td>地址</td>
			<td colspan="3">
				<?= $model->address ?>
			</td>
		</tr>
		<tr class="even">
			<td> 發票類型：</td>
			<td colspan="3">
				<?=Yii::app()->params['receipttype'][$model->receipt_type]?>
				&nbsp;&nbsp;&nbsp;&nbsp;
				<?php
				switch($model->receipt_type){
					case 1:
						echo '買受人： '.$model->receipt_field1;
						break;
					case 2:
						echo '捐贈單位： '.$model->receipt_field1;
						break;
					case 3:
						echo '買受人： '.$model->receipt_field1;
						break;
					case 4:
						echo '統一編號： '.$model->receipt_field1.'&nbsp;&nbsp;&nbsp;&nbsp;發票抬頭： '.$model->receipt_field2;
						break;
					default:
						echo '買受人： '.$model->receipt_field1;
				}				
				?>
			</td>
		</tr>
	</tbody>
</table>
<div style="height:10px;">&nbsp;</div>
<table cellspacing="0" cellpadding="0" width="100%" class="detail-view tbl">
	<tr class="head">
		<th width="40%">名稱</th>
		<th width="20%">單價</th>
		<th width="20%">數量</th>
		<th width="20%">小計</th>
	</tr>
	<?php
    $i = 0;
    $cssArr = array(0 => 'even', 1 => 'odd');
    foreach ($model->items as $item) {
        $trClass = $cssArr[$i % 2];
        $i++;
        ?>
	<tr class="<?= $trClass ?>">
		<td>
			<?=$item->product->pname?>
		</td>
		<td>$
			<?=$item->price?>
		</td>
		<td>
			<?=$item->number?>
		</td>
		<td>$
			<?=$item->price*$item->number?>
		</td>
	</tr>
	<?php
    }
    ?>
</table>
